Skip to content

Conversation

ohader
Copy link

@ohader ohader commented Sep 17, 2025

Q A
Bug fix? no
New feature? yes
Docs? yes
Issues Fix #629
License MIT

This change allows fetch actual available models from the platform.
The new \Symfony\AI\Platform\ModelDefinition holds all details.

ModelClients implementing the new \Symfony\AI\Platform\ModelDefinitionsAwareInterface are basically capable of retrieving their actual model definitions.

$platform = new \Symfony\AI\Platform\Bridge\Ollama\PlatformFactory(
  'http://localhost:11434'
);

foreach ($platform->fetchModelDefinitions() as $modelDefinition) {
    $modelCapabilities = array_map(
        static fn (Capability $capability): string => $capability->value,
        $modelDefinition->getCapabilities()
    );
    echo sprintf(
        " + %s (%s)\n",
        $modelDefinition->getName(),
        implode(', ', $modelCapabilities)
    );
}

Todo

  • implement fetchModelDefinitions() for other platform-specific ModelClient classes as well

This change allows fetch actual available models from the platform.
The new `\Symfony\AI\Platform\ModelDefinition` holds all details.

$platform = new \Symfony\AI\Platform\Bridge\Ollama\PlatformFactory(
  'http://localhost:11434'
);
$platform->fetchModelDefinitions();

Related: symfony#629
@carsonbot carsonbot added Feature New feature Platform Issues & PRs about the AI Platform component Status: Needs Review labels Sep 17, 2025
@ohader ohader marked this pull request as draft September 17, 2025 18:17
@ohader
Copy link
Author

ohader commented Sep 17, 2025

In case you confirm, my approach would be acceptable, I'd continue adjusting the other platform-specific ModelClient classes step by step.

@JoshuaBehrens
Copy link
Contributor

@ohader that really matches the discussion we had here #299 (review) where it was on how to know which models are available. Later on I see this as a benefit for connection pooling to different services. as long as you know which connection can provide a certain model you can correctly route. Is there something I should add to my pull request so we can combine things better?

@ohader
Copy link
Author

ohader commented Sep 30, 2025

Using ModelCatalog helped to provide custom behavior (like resolving available models in our own specific code) (see #629 (comment) for more details).

@ohader ohader closed this Sep 30, 2025
@ohader ohader deleted the issue-629 branch October 1, 2025 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature Platform Issues & PRs about the AI Platform component Status: Needs Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Platform] Allow fetching available models per platform
3 participants